use global_BLAs_09_21_21.dta, clear

drop if year<1945 | year>2021

*Unique dyad
egen udyad = tag(dyad_id)

*Time periods
gen time_int = ceil((year-1945)/10)

*Language
gen code_language = 1 if doc_language=="English" & copyavailable==1 & google_translate==0
replace code_language = 2 if google_translate==1 & copyavailable==1 & !regexm(doc_language, "Spanish") ///
	& !regexm(doc_language, "Portugese") & !regexm(doc_language, "Arabic")
replace code_language = 3 if copyavailable==1 & regexm(doc_language, "Arabic")
replace code_language = 4 if copyavailable==1 & regexm(doc_language, "Spanish")
replace code_language = 5 if copyavailable==1 & regexm(doc_language, "Portugese")
replace code_language = 6 if copyavailable==1 & missing(code_language)

*1) Number of treaties over time

preserve

	collapse (count) ID (sum) udyad, by(year)
	sort year
	gen treatysum = sum(ID)
	gen dyadsum = sum(udyad)
	
	#delimit;
	
	twoway (bar ID year, yaxis(1) color(navy%50))
		(line treatysum year, lc(black) yaxis(2)) (line dyadsum year, lc(black) lp(dash) yaxis(2))
		, xlab(#15, angle(45) labsize(*0.7)) ylab(#10, labsize(*0.7) angle(0) axis(1))
		ylab(#10, labsize(*0.7) angle(0) axis(2))
		graphregion(color(white)) xt("") yt("") name(bla_sum, replace)
		legend(order( 2 "Cumulative BLAs signed" 3 "Cumulative unique dyads with BLAs" 1 "BLAs signed") rows(2) size(*0.6));
	
	#delimit cr

restore
